home *** CD-ROM | disk | FTP | other *** search
- /* Drawbox.c Copyright 1991 Dave Newman.
- Permission for any use is granted
- as long as this notice is included.
- These functions need the bios_disp
- function package to work */
-
- #include <bios.h>
- #include <box.h>
-
- /* this routine draws a box using the
- IBM box characters. The routine is smart
- enough to get the corners right using the
- single or double line characters.
- Type should be 1 or 2 for single or double lines */
-
- void draw_box(
- int srow, int scol,int erow,int ecol,int type)
- {
-
- /* right vert line */
- draw_vline(srow,ecol,erow,type);
-
- /* left vert line */
- draw_vline(srow,scol,erow,type);
-
- /* top horiz line */
- draw_hline(srow,scol,ecol,type);
-
- /* bottom horiz line */
- draw_hline(erow,scol,ecol,type);
-
- /* fix the corners */
- bios_move(srow,scol);
- if(type == 2)
- bios_pchatt(201);
- else
- bios_pchatt(218);
-
- bios_move(srow,ecol);
- if(type == 2)
- bios_pchatt(187);
- else
- bios_pchatt(191);
-
- bios_move(erow,scol);
- if(type == 2)
- bios_pchatt(200);
- else
- bios_pchatt(192);
-
- bios_move(erow,ecol);
- if(type == 2)
- bios_pchatt(188);
- else
- bios_pchatt(217);
- }
-
- void draw_hline(int srow,int scol,int ecol,int type)
- {
- int x;
-
- bios_move(srow,scol);
- if(type == 2)
- bios_pchatt(204);
- else
- bios_pchatt(195);
-
- for(x=scol+1; x < ecol; x++)
- {
- bios_move(srow,x);
- bios_pchatt(205);
- }
- bios_move(srow,ecol);
- if(type == 2)
- bios_pchatt(185);
- else
- bios_pchatt(180);
- }
-
- void draw_vline(int srow,int scol,int erow,int type)
- {
- int x;
-
- bios_move(srow,scol);
- if(type == 2)
- bios_pchatt(203);
- else
- bios_pchatt(194);
-
- for(x=srow+1; x< erow; x++)
- {
- bios_move(x,scol);
- bios_pchatt(186);
- }
- bios_move(erow,scol);
- if(type == 2)
- bios_pchatt(202);
- else
- bios_pchatt(193);
- }
-
-
-